<template>
	<view class="content" style="width: 100%; height: 100%;">
		<view style="text-align: center;">
		</view :loginForm>
			<text class="title" style="text-align: center; font-size: 40rpx; font-family: PingFangSC-Medium, PingFang SC; font-weight: bolder;">随手智能营销平台</text>
			<text class="title" style="text-align: center; font-size: 30rpx; font-family: PingFangSC-Medium, PingFang SC; margin-top: 100rpx;">供货端登录</text>
		<view style="padding: 60rpx; position: absolute; top: 350rpx;">
			<view>
				<input class="input1" placeholder-style='color:#AAAAAA;' v-model='loginForm.ghUser' placeholder="请输入账户名" />
			</view>
			<view>
				<input class="input1" type='password' placeholder-style='color:#AAAAAA'  v-model='loginForm.ghPwd' placeholder="请输入密码" />
			</view>
			<view style="height: 25rpx; color: #FF5C50; font-size: 26rpx; margin-top: 20rpx;">
				<span v-show='error'>用户不存在/密码错误</span>
			</view>
      
	
		  
			<button style="margin-top: 60rpx; background-color: #6CCACF; border-radius: 45rpx; color: #FFFFFF; width: 200rpx;"  @click="userLogin()">登录</button>
    
     
      
		</view>
	</view>
</template>

<script>
	import axios from 'axios'
import config from '../../common/config'
	export default {
		data() {
			return {
				loginForm:{
				            ghUser: '',
				            ghPwd: ''
				          },
			code:0
			}
		},
		computed:{
			
			      },
		onLoad() {
			
		},
		
		methods: {
			userLogin() {
				axios.post(config.baseUrl+"supplier/ssmsupplier/login",this.loginForm)
				.then((response)=>{
					
					console.log(response.data.data)
				
					uni.setStorageSync('token',response.data.token)
					uni.setStorageSync('phone',response.data.phone)
					
					
					this.code=response.data.code
					
					
					if(this.code == 401){
						uni.showToast({
							title:response.data.msg,
							icon:'error'
						})
					}
					if(this.code == 402){
						uni.showToast({
							title:response.data.msg,
							icon:'error'
						})
					}
					if(this.code == 403){
						uni.showToast({
							title:response.data.msg,
							icon:'error'
						})
					}
					
					if(this.code == 404){
						uni.showToast({
							title:response.data.msg,
							icon:'error'
						})
					}
					
				
					
					if(this.code==0){
						uni.reLaunch({
							url:"/pages/dingdan/dingdan",
						
						})
						
						uni.setStorageSync('ghId',response.data.data.ghId)
						uni.setStorageSync('ghPwd',response.data.data.ghPwd)
						
						
					}
					
				})
				
			},
		}
	}
</script>

<style>
	page {
		background-image:linear-gradient(to bottom right,#6CCACF,#FBFCFB);
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.text-login {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		border-radius: 20rpx;
		background: #ffffff;
		margin-top: 80rpx;
		width: 660rpx;
		height: 1050rpx;
	}
	.title {
		color: black;
		position: absolute;
		top: 200rpx;
	}
	.input1 {		
		height: 80rpx;
		width: 500rpx;
		padding: 10rpx;
		margin: 30rpx;
		background-color: #FBFBFB;
		border-radius: 45rpx;
	}
  .text-mima{
     font-size: 30rpx;
        color: gray;
        text-align: right;
  }
</style>

